Skip to content

fix: properly hide menu bar items on ultra-wide and multi-monitor setups#354

Closed
laveez wants to merge 1 commit into
dwarvesf:developfrom
laveez:bugfix/fix-ultrawide-multimonitor-collapse
Closed

fix: properly hide menu bar items on ultra-wide and multi-monitor setups#354
laveez wants to merge 1 commit into
dwarvesf:developfrom
laveez:bugfix/fix-ultrawide-multimonitor-collapse

Conversation

@laveez

@laveez laveez commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Problem

Since v1.10, hidden menu bar items reappear on ultra-wide monitors and multi-display setups. The collapse width is calculated from the currently focused screen rather than the widest one, so switching focus to a smaller display causes items to show through. Additionally, connecting or disconnecting a display resets the collapsed state.

Solution

  • Calculate collapse width from the widest connected display
  • Raise the collapse width cap from 4,000 to 10,000 (macOS maximum)
  • Preserve collapsed state when displays are connected/disconnected
  • Make collapsed state detection resilient to width recalculations

Testing

Tested on MacBook Pro with external ultra-wide (3440x1440). Collapse/expand, display switching, display connect/disconnect, auto-hide, and always-hidden section all work correctly.

Related

Fixes #314, fixes #345, fixes #353. Supersedes #347.

- Fix collapse calculation to use the widest connected display instead
  of the currently focused screen
- Raise the collapse width cap from 4,000 to 10,000 (macOS hard limit)
- Keep the bar collapsed when displays are connected or disconnected
- Fix collapsed state detection to be resilient to width recalculations

Fixes dwarvesf#314, fixes dwarvesf#345, fixes dwarvesf#353
@laveez

laveez commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

Requesting review from @viettrungphan, @phucledien

@laveez laveez changed the base branch from master to develop April 14, 2026 13:14
@rogeriobueno

Copy link
Copy Markdown

I'm having the same problem on a monitor with a resolution of 5120x1440.

@maranza

maranza commented Apr 17, 2026

Copy link
Copy Markdown

We need someone to review and merge please.

@phucledien
@viettrungphan

@jlucktay

Copy link
Copy Markdown

I also have this issue, on a secondary monitor that is 2560x1440.

sdenike added a commit to sdenike/hidden-revived that referenced this pull request Apr 23, 2026
- chore: bump deployment target to macOS 10.13 (Xcode 26 requirement)
- fix: properly hide menu bar items on ultra-wide and multi-monitor setups (PR dwarvesf#354, laveez)

Closes upstream dwarvesf#314, dwarvesf#345, dwarvesf#353.
sdenike added a commit to sdenike/hidden-revived that referenced this pull request Apr 23, 2026
Adds the non-overlapping pieces of huynguyenh's PR dwarvesf#335 on top of
rm335's PR dwarvesf#346. Handles the biggest leak source (NSLayoutConstraint
retention when NSImageViews were recreated 9-10 times per toggle).

- Deactivate NSLayoutConstraints before removing views in
  NSStackView.removeAllSubViews (prevents constraint retention of
  removed NSImageViews — primary leak source on macOS Sequoia/Tahoe)
- Extend StatusBarController.deinit to invalidate timer and remove
  the always-hidden NSStatusItem
- Change toggleStatusBarIfNeeded to only create the always-hidden
  status item when it doesn't already exist, instead of tearing down
  and recreating on every .alwayHideToggle notification

Combined with the widest-display collapse-length calc in dwarvesf#354 and the
bounded-length work in dwarvesf#344, this should resolve the runaway memory
growth reported in upstream dwarvesf#326, dwarvesf#336, dwarvesf#351, dwarvesf#352.

Co-Authored-By: huynguyenh <hoanghuy2908@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdenike added a commit to sdenike/hidden-revived that referenced this pull request Apr 29, 2026
- chore: bump deployment target to macOS 10.13 (Xcode 26 requirement)
- fix: properly hide menu bar items on ultra-wide and multi-monitor setups (PR dwarvesf#354, laveez)

Closes upstream dwarvesf#314, dwarvesf#345, dwarvesf#353.
sdenike added a commit to sdenike/hidden-revived that referenced this pull request Apr 29, 2026
Adds the non-overlapping pieces of huynguyenh's PR dwarvesf#335 on top of
rm335's PR dwarvesf#346. Handles the biggest leak source (NSLayoutConstraint
retention when NSImageViews were recreated 9-10 times per toggle).

- Deactivate NSLayoutConstraints before removing views in
  NSStackView.removeAllSubViews (prevents constraint retention of
  removed NSImageViews — primary leak source on macOS Sequoia/Tahoe)
- Extend StatusBarController.deinit to invalidate timer and remove
  the always-hidden NSStatusItem
- Change toggleStatusBarIfNeeded to only create the always-hidden
  status item when it doesn't already exist, instead of tearing down
  and recreating on every .alwayHideToggle notification

Combined with the widest-display collapse-length calc in dwarvesf#354 and the
bounded-length work in dwarvesf#344, this should resolve the runaway memory
growth reported in upstream dwarvesf#326, dwarvesf#336, dwarvesf#351, dwarvesf#352.

Co-Authored-By: huynguyenh <hoanghuy2908@gmail.com>
@maranza

maranza commented May 5, 2026

Copy link
Copy Markdown

Hello @tieubao I hope you all is well. May we please request for your help with merging this issue please. Thank you.

Kind Regards,
Maranza

@scholarazwa

Copy link
Copy Markdown

Yes please, we really need this to be merged to the main branch. Thank you.

@maranza

maranza commented May 20, 2026

Copy link
Copy Markdown

Hello @tieubao I hope you all is well. May we please request for your help with merging this issue please. Thank you.

Kind Regards,
Maranza

tieubao added a commit that referenced this pull request Jun 11, 2026
Absorbs the still-relevant pieces of three community PRs that overlapped this branch, with authorship credit:

- collapse length re-applies to the live separator when displays change, and isCollapsed compares > btnHiddenLength so the state survives the recompute; collapse sizing uses frame.width x2 capped at the documented 10,000pt NSStatusItem maximum (from #354)
- NSLayoutConstraint.deactivate before removeFromSuperview in removeAllSubViews, plugging the tutorial-view rebuild leak (from #335)
- PreferencesViewController balances its prefsChanged observer in deinit (from #335/#346)

Co-authored-by: Laveez <niko.muukkonen1@gmail.com>
Co-authored-by: huynguyenh <hoanghuy2908@gmail.com>
Co-authored-by: Rob Mulder <hallo@robmulder.com>
@tieubao

tieubao commented Jun 11, 2026

Copy link
Copy Markdown
Member

Thanks for this: it caught two things the in-flight #363 branch had missed. We've absorbed your live length re-apply on display change, the isCollapsed > btnHiddenLength robustness fix, and the frame.width x2 / 10,000pt cap into commit 8582e4b on #363, with a Co-authored-by credit so it lands under your name when the stack merges. If you'd rather carry the change yourself we can also rebase this PR instead; otherwise we'll close it once #363 merges.

tieubao added a commit that referenced this pull request Jun 11, 2026
Absorbs the still-relevant pieces of three community PRs that overlapped this branch, with authorship credit:

- collapse length re-applies to the live separator when displays change, and isCollapsed compares > btnHiddenLength so the state survives the recompute; collapse sizing uses frame.width x2 capped at the documented 10,000pt NSStatusItem maximum (from #354)
- NSLayoutConstraint.deactivate before removeFromSuperview in removeAllSubViews, plugging the tutorial-view rebuild leak (from #335)
- PreferencesViewController balances its prefsChanged observer in deinit (from #335/#346)

Co-authored-by: Laveez <niko.muukkonen1@gmail.com>
Co-authored-by: huynguyenh <hoanghuy2908@gmail.com>
Co-authored-by: Rob Mulder <hallo@robmulder.com>
tieubao added a commit that referenced this pull request Jun 11, 2026
Absorbs the still-relevant pieces of three community PRs that overlapped this branch, with authorship credit:

- collapse length re-applies to the live separator when displays change, and isCollapsed compares > btnHiddenLength so the state survives the recompute; collapse sizing uses frame.width x2 capped at the documented 10,000pt NSStatusItem maximum (from #354)
- NSLayoutConstraint.deactivate before removeFromSuperview in removeAllSubViews, plugging the tutorial-view rebuild leak (from #335)
- PreferencesViewController balances its prefsChanged observer in deinit (from #335/#346)

Co-authored-by: Laveez <niko.muukkonen1@gmail.com>
Co-authored-by: huynguyenh <hoanghuy2908@gmail.com>
Co-authored-by: Rob Mulder <hallo@robmulder.com>
@tieubao

tieubao commented Jun 11, 2026

Copy link
Copy Markdown
Member

Merged into develop via #363 (commit cf66bfe) with your Co-authored-by credit: the live re-apply on display change, the isCollapsed robustness fix, and the 10,000pt cap all came from this PR. Thanks again; closing now that it's in.

@tieubao tieubao closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants